<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="org.edu.system.DBConnect" %>
<%@ page import="java.sql.*" %>
<%
	String tc_id = (String)(session.getAttribute("UserName"));
	String sql = "SELECT * FROM teacher WHERE tc_id = '" + tc_id + "'";
	System.out.println(sql);
	
	Connection con = DBConnect.getCon();
	Statement stmt = null;
	ResultSet rs = null;
	stmt = con.createStatement();
	rs = stmt.executeQuery(sql);//执行命令
	if (rs.next())// 如果记录集非空，表明有匹配的用户ID
	{
			//正常进行
	} else {
		// 否则登录失败
		// response.sendRedirect ( "MyJsp.jsp" );
		response.sendRedirect("login_failure.jsp");
	}
%>
<!DOCTYPE html>
<html>
<head>
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src="./bootstrap/js/jquery.min.js"></script>
<script src="./bootstrap/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<title>教师教务管理系统 - 成绩管理</title>
</head>
<body style="width:900px; margin:0 auto;">
<div id="header">
<table border="0" width="100%">
	<tr>
		<td>
		<div class="page-header">
		<% 
			String username = null;
			sql = "SELECT tc_name FROM teacher WHERE tc_id = '" + tc_id + "'";
			stmt = null;
			rs = null;
			stmt = con.createStatement();
			rs = stmt.executeQuery(sql);//执行命令
			if (rs.next())// 如果记录集非空，表明有匹配的用户ID
			{
				username = rs.getString("tc_name");
			} 
		%>
		<h1>教师教务管理系统 <small>您好啊，<%=username%></small></h1>
		</div>
		</td>
		<td align="right">
			<div><a href="./logout.jsp" style="font-size:15px">注销</a></div>
		</td>
	</tr>
</table>
</div>
	<div id="navigation">
		<ul id="myTab" class="nav nav-tabs">
		  <li role="presentation" class="active"><a href="tea_attendance.jsp" target="iframe1">学生考勤</a></li>
		  <li role="presentation"><a href="tea_grade.jsp" target="iframe1">成绩管理</a></li>
		  <li role="presentation"><a href="teacher_kebiao.jsp" target="iframe1">查看课表</a></li>
		  <li role="presentation"><a href="teacher_evaluation.jsp" target="iframe1">查看评教</a></li>
		  <li role="presentation"><a href="tc_grxx.jsp" target="iframe1">个人信息</a></li>
		</ul>
	</div>
	<div id="container">
		<iframe name="iframe1" id="iframe1" src="./tea_attendance.jsp" frameborder="no" width="100%" height="800px"
			scrolling="auto"></iframe>
	</div>
	<script> 
      $(function () { 
        $('#myTab a:first').tab('show');//初始化显示哪个tab 
      
        $('#myTab a').click(function (e) { 
          $(this).tab('show');//显示当前选中的链接及关联的content 
        }) 
      }) 
    </script>
</body>
</html>